<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>基本信息</title>
<link type="text/css" href="../css/checkPage.css" rel="stylesheet"/>
<link type="text/css" href="../css/shCompany.css" rel="stylesheet" >
<link type="text/css" href="../js/jDialog/jDialog.css" rel="stylesheet" >
<script type="text/javascript" src="../js/jDialog/jquery.dialog.js"></script>
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
var sumPage=1;//总页数
var nowPage=1;//当前页数
var nowCount=1;//一页显示的条数
var sumCount=0;//总条数
var nowMin=1;//当前显示第一排的序号
var nowMax=1;//当前显示最后第一排的序号
var userObj;
var i;
$(document).ready(function() {
	$.initFrame();
	if(sumCount == 0){
		$("#tableInfo").append("<tr><td colspan='4'>没有数据</td></tr>");
		$.InitValue(0,0);
	}else{
		if(sumCount%nowCount==0)
			sumPage=sumCount/nowCount;
		else
			sumPage=Math.floor(sumCount/nowCount)+1;//根据记录数和每页显示条数获取总页数
		$.InitValue(1,nowMax);
	}
	$.checkPagesnum();
});
$.initFrame = function(){
	$.ajax({
		type : 'post',
		dataType : 'text',
		async: false,
		url : '../user/getAllUncheckUser.action',
		success : function(msg) {
			if(msg.length<=2){
				sumCount=0;
			}else{
				userObj = JSON.parse(msg);
				sumCount = userObj.length;
	 			for(i=0;i<nowCount;i++)
	 				$.appendTip(i);
	 			nowMin=1;
	 			nowMax=i;
			}
 			$("#sumCount").html(sumCount);
		}
	});
}
$.appendTip = function(j){
	$("#tableInfo").append("<tr><td>"+(j+1)+"</td><td>"+userObj[i].userLoginName+"</td><td>"+userObj[i].userNickName+"</td><td><input type='button' title='通过' alt='拒绝' value='通过' onclick='$.checkInfo("+userObj[i].userId+",1)' style='background-color:#A4D3EE;' class='opbun'/>&nbsp;&nbsp;&nbsp;<input onclick='$.checkInfo("+userObj[i].userId+",-1)' type='button' title ='拒绝' alt='拒绝' value='拒绝' class='opbun' style='background-color:#A52A2A;'/></td></tr>");
}
$.checkInfo = function(userId,status){
	var title;
	if(status == -1)
		title = "确定审核不通过？";
	else
		title = "确定审核通过？";
	var dialog = jDialog.confirm(title,{
		handler : function(button,dialog) {
			$.ajax({
				type: 'post',
				dataType:'text',
				url:'../user/checkUserInfo.action',
				data:{
					"userDTO.userId":userId,
					"userDTO.userStatus":status
				},
				success:function(msg) {
					if(msg == 1)
						alert("操作成功");
					else
						alert("操作失败");
					window.location.reload();
				}
			})
			dialog.close();
		}
	},{
		handler : function(button,dialog) {
			dialog.close();
		}
	});
}
</script>
<script type="text/javascript" src="../js/showInfolist.js"></script>
<body>
<div class="mineInfo">
<span id="info1">用户列表&nbsp;USERLIST</span>
<hr style="height:1px;border:none;border-top:1px solid #555555;" />
</div>
<div id="seleDiv">
<span>一页显示</span><select onchange="$.changCount(this)"><option selected="selected">1</option><option>2</option><option>3</option><option>4</option><option>5</option></select><span>条记录</span>
</div>
<table id="tableInfo" border="1" rules="rows">
<tr>
<th width="20%">序号</th>
<th width="20%">用户名</th>
<th width="20%">姓名</th>
<th width="25%">操作</th>
</tr>
</table>
<div id="pageButton">
<a>当前显示<span id="firtLine" style="font-weight:bold;">0</span><span>到</span><span id="lastLine" style="font-weight:bold;">0</span><span>条,共</span><span id="sumCount" style="font-weight:bold;">2</span><span>条记录</span></a>
<a>第<span style="font-weight:bold;" id="nopage">1</span>/<span style="font-weight:bold;" id="alpage">1</span>页</a>
<span id="cpage"><a onclick="$.firstPage()" id="fipage">首页</a>
<a onclick="$.formPage()" id="fopage">上一页</a>
<a onclick="$.nextPage()" id="nepage">下一页</a>
<a onclick="$.lastPage()" id="lapage">尾页</a></span>
</div>
</body>
</html>